{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. 变量的定义和使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "玛利亚\n",
      "标识 2607016367184\n",
      "类型 <class 'str'>\n",
      "值 玛利亚\n"
     ]
    }
   ],
   "source": [
    "name = '玛利亚'\n",
    "print(name)\n",
    "\n",
    "print('标识', id(name)) # 变量有标识id(obj) \n",
    "print('类型', type(name)) # 变量有类型type(obj)\n",
    "print('值', name) # 变量有值value"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2. 变量的多次赋值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "玛利亚\n",
      "出溜冰\n"
     ]
    }
   ],
   "source": [
    "name = '玛利亚'\n",
    "print(name)\n",
    "name = '出溜冰'  # 变量的多次赋值，name指向新的空间，\n",
    "print(name)  # 原来的地方没有东西了，被称为内存垃圾，垃圾回收机制进行回收"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.6.3",
   "language": "python",
   "name": "python3.6.3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
